<?php
header('content-type:text/html;charset=utf-8');
$link=mysqli_connect('localhost','root','','a');
mysqli_set_charset($link,'utf8');
$sql = 'select * from goods ';
$result = mysqli_query($link,$sql);
// 创建一个数组，用来存储查询到的结果
$arr=[];
while($row = mysqli_fetch_assoc($result)){
    array_push($arr,$row);
}
echo json_encode($arr);
mysqli_close($link);

?>